<template>
	<view>
		<free-popup ref="confirm" center maskColor transformOrigin="center center">
			<view class="bg-white rounded" style="width:600rpx;">
				<view class="pt-4 pr-2 pl-2 flex flex-column">
					<text class="font-md font-weight-bold mb-3 text-center">{{title}}</text>
					<slot></slot>
					<!-- <scroll-view scroll-x="true" class="flex" :show-scrollbar="false">
						<view class="mr-1">
							<free-avater src="/static/images/mail/friend.png" size="60"></free-avater> 
						</view> 
					</scroll-view>
					<view class="my-3 ">
						<text class="font text-light-muted">[个人名片]昵称</text> 
					</view> 
					<input type="text" class="font-md bg-light rounded pl-2" style="height:60rpx;" placeholder="给朋友留言"> -->
				</view>
				<!-- 底部 -->
				<view class="flex align-stretch" style="height:100rpx">
					<view class="flex-1  flex align-center justify-center" @click="cancel">
						<text class="font-md text-muted">取消</text>
					</view>
					<view class="flex-1 flex align-center justify-center" @click="confirm">
						<text class="font-md main-text-color">确定</text>
					</view>
				</view>
			</view>
		</free-popup>
	</view>
</template>

<script>
	import freePopup from "@/components/free-ui/free-popup.vue";
	export default {
		components: {
			freePopup,
		},
		props:{
			title:{
				type:String,
				default:"提示"
			}
		},
		data(){
			return{
				callback:false,
			}
		},
		methods:{
			// 显示
			show(callback = false){
				this.callback = callback
				this.$refs.confirm.show()
				// this.$refs.confirmShow.show()
			},
			// 取消
			cancel(){
				this.$refs.confirm.hide()
			},
			// 确定
			confirm(){
				if(typeof this.callback === 'function'){
					this.callback(() => {
						this.cancel()
					})
				}
			}
		}
	}
</script>

<style>
</style>